﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Net.Mail;

using System.Web.Services;

using System.IO.MemoryMappedFiles;

public partial class realia_HomeDetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn15 = null;
        conn15 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn15.Open();
        SqlCommand cmd15 = new SqlCommand("select * from agent_add where ID=(SELECT MAX(ID) FROM agent_add)  ", conn15);
        SqlDataReader dr15 = cmd15.ExecuteReader();
        if (dr15.Read())
        {

            Label119.Text = dr15[2].ToString();
            Label125.Text = dr15[15].ToString();
            Label121.Text = dr15[13].ToString();
       
           

            dr15.Close();
        }
        conn15.Close();
        SqlConnection conn16 = null;
        conn16 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn16.Open();
        SqlCommand cmd16 = new SqlCommand("select * from agent_add where ID=(SELECT MAX(ID)-1 FROM agent_add)   ", conn16);
        SqlDataReader dr16 = cmd16.ExecuteReader();
        if (dr16.Read())
        {

            Label122.Text = dr16[2].ToString();
            Label123.Text = dr16[15].ToString();
            Label124.Text = dr16[13].ToString();

     
            dr16.Close();
        }
        conn16.Close();
        SqlConnection conn= null;
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn.Open();
        SqlCommand cmd = new SqlCommand("select * from properties where ID=(SELECT MAX(ID) FROM properties)", conn);
        SqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
        {

          
            Label38.Text = dr[1].ToString();
            Label37.Text = dr[6].ToString();
            Label39.Text = dr[4].ToString();
            


            dr.Close();
        }
        //conn.Close();
        conn.Close();
        SqlConnection conn2 = null;
        conn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn2.Open();
        SqlCommand cmd2 = new SqlCommand("select * from properties where ID=(SELECT MAX(ID)-1 FROM properties)", conn2);
        SqlDataReader dr2 = cmd2.ExecuteReader();
        if (dr2.Read())
        {

         
            Label40.Text = dr2[6].ToString();
            Label41.Text = dr2[1].ToString();
            Label42.Text = dr2[4].ToString();

           
            dr2.Close();
        }
        conn2.Close();
        SqlConnection conn3 = null;
        conn3 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn3.Open();
        SqlCommand cmd3 = new SqlCommand("select * from properties where ID=(SELECT MAX(ID)-2 FROM properties)", conn3);
        SqlDataReader dr3 = cmd3.ExecuteReader();
        if (dr3.Read())
        {

 
            Label43.Text = dr3[6].ToString();
            Label44.Text = dr3[1].ToString();
            Label45.Text = dr3[4].ToString();
            
            dr3.Close();
        }
        conn3.Close();
        SqlConnection conn4 = null;
        conn4 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn4.Open();
        SqlCommand cmd4 = new SqlCommand("select * from properties where ID=(SELECT MAX(ID)-3 FROM properties) ", conn4);
        SqlDataReader dr4 = cmd4.ExecuteReader();
        if (dr4.Read())
        {

          
            Label46.Text = dr4[6].ToString();
            Label47.Text = dr4[1].ToString();
            Label48.Text = dr4[3].ToString();
            dr4.Close();
        }
        conn4.Close();
    }
}